package demo13;

import java.io.*;
import java.net.*;
import java.util.*;

public class DicTcpEchoServer extends TcpEchoServer{
    Map<String,String> hash=new HashMap<>();
   public DicTcpEchoServer(int port) throws IOException {
       super(port);
       hash.put("dog","小狗");
       hash.put("cat","小猫");
       hash.put("pig","小猪");
       hash.put("stupid","菲");
   }

    public String process(String request) {
        return hash.containsKey(request)?hash.get(request):"词典中不存在该单词";
    }

    public static void main(String[] args) throws IOException {
        DicTcpEchoServer dicTcpEchoServer=new DicTcpEchoServer(9091);
        dicTcpEchoServer.start();
    }

}
